package com.az.miaoapi.feign;

import com.az.miaoapi.dto.Product;
import com.az.miaoapi.dto.Type;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author zj
 * @time 2024/9/25 15:27
 */


/**
 * @author zj
 * @time 2024/9/25 15:27
 */
@FeignClient(name = "item-service")
public interface ItemClient {

        @GetMapping("/item/check-inventory")
        Boolean checkInventory(
                @RequestParam("productId") Integer productId,
                @RequestParam("typeId") Integer typeId,
                @RequestParam("count") Integer count);

        @GetMapping("/item/deduct-inventory")
        Boolean deductInventory(
                @RequestParam("typeCountMap")  Map<Integer, Integer> typeCountMap,
                @RequestParam("productId") Integer productId);

        @GetMapping("/item/get-product")
        Product getProductById(
                @RequestParam("productId") Integer productId);

        @GetMapping("/item/get-productByName")
        List<Product> listProductByName(
                @RequestParam("name") String name);

        @GetMapping("/item/get-type")
        Type getTypeById(
                @RequestParam("typeId") Integer typeId);

        Map<Integer, Type> batchGetTypeByIds(List<Integer> typeIds);

        Map<Integer, Product> batchGetProductsByIds(List<Integer> productIds);


}



